package cn.com.dhc.danlu.activity.delivery.order.typefactory;

import android.view.View;

import cn.com.dhc.danlu.R;
import cn.com.dhc.danlu.activity.delivery.order.bean.BaseHolderBean;
import cn.com.dhc.danlu.activity.delivery.order.bean.OrderFuncBean;
import cn.com.dhc.danlu.activity.delivery.order.bean.OrderStatusBean;
import cn.com.dhc.danlu.activity.delivery.order.delegate.IHolderDataCallback;
import cn.com.dhc.danlu.activity.delivery.order.viewholder.BaseViewHolder;
import cn.com.dhc.danlu.activity.delivery.order.viewholder.OrderDataViewHolder;
import cn.com.dhc.danlu.activity.delivery.order.viewholder.OrderFuncViewHolder;
import cn.com.dhc.danlu.activity.delivery.order.viewholder.OrderStatusViewHolder;

/**
 * author: 李一方(<a href="mailto:liyifang@danlu.com">liyifang@danlu.com</a>)<br/>
 * version: 1.0.0<br/>
 * since: 2017-02-14 15:12
 * <p>
 * <p>
 * 内容描述区域
 * </p>
 */
public class OrderTypeFactory implements IOrderTypeFactory {
    private static final int ORDER_STATUS_LAYOUT = R.layout.item_my_orders_status;
    private static final int ORDER_DATA_LAYOUT = R.layout.item_my_orders_data;
    private static final int ORDER_FUNC_LAYOUT = R.layout.item_my_orders_func;

    @Override
    public int type(OrderStatusBean orderStatusBean) {
        return ORDER_STATUS_LAYOUT;
    }

    @Override
    public int type(BaseHolderBean orderDataBean) {
        return ORDER_DATA_LAYOUT;
    }

    @Override
    public int type(OrderFuncBean orderFuncBean) {
        return ORDER_FUNC_LAYOUT;
    }

    @Override
    public BaseViewHolder createViewHolder(int type, View itemView, IHolderDataCallback callback) {
        switch (type) {
            case ORDER_STATUS_LAYOUT:
                return new OrderStatusViewHolder(itemView, callback);

            case ORDER_DATA_LAYOUT:
                return new OrderDataViewHolder(itemView);

            case ORDER_FUNC_LAYOUT:
                return new OrderFuncViewHolder(itemView, callback);

            default:
                return null;
        }
    }
}
